<?php
	session_start();
	$cekin = $_POST['cekin'];
	$cekout = $_POST['cekout'];
	$hotel = $_POST['nm_hotel'];
	$jenis = $_POST['nm_jenis'];
	
	include_once("connect.php");
	$query1 = "select id_hotel from hotel where nama_hotel='$hotel'";
	$query2 = "select id_jenis_kamar from jenis_kamar where jenis_kamar='$jenis'"; 
	$exe = mysql_query($query1);
	$id_hotel = mysql_fetch_row($exe);
	echo "hotel = ".$id_hotel;
	$exe2 = mysql_query($query2);
	$id_jenis = mysql_fetch_row($exe2);
		echo "jenis= ".$id_jenis;
	
	$query3 = "select count(no_kamar) from kamar_kosong where id_hotel = '$id_hotel' AND id_jenis_kamar = '$id_jenis'";
	$exe3=mysql_query($query3);
	$row = mysql_fetch_row($exe3);
	echo "row".$row[0];
	
	if($row[0] != 0){
		echo "<script language='javascript'> alert('kamar available'); window.location ='booking.php';</script>";
	}else{
		echo "<script language='javascript'> alert('kamar unavailable'); window.location ='index.php';</script>";
	}
	
	
	
	mysql_close($con);
	
?>